package com.duowei.diandan.binding;

import android.databinding.BindingAdapter;
import android.widget.LinearLayout;

public class LinearLayoutBindingAdapter {

    @BindingAdapter("android:layout_width")
    public void setLayoutWidth(LinearLayout view, float width) {
        LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) view.getLayoutParams();
        params.width = (int) width;
        view.setLayoutParams(params);
    }

    @BindingAdapter("android:layout_weight")
    public void setLayoutWeight(LinearLayout view, float weight) {
        LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) view.getLayoutParams();
        params.weight = weight;
        view.setLayoutParams(params);
    }
}
